#include "org_gzy_xiaolian_CallCppFunc.h"
#include "AccountManager.h"
#include "PayManager.h"
#include "platform/android/jni/JniHelper.h"

using namespace cocos2d;
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     org_gzy_xiaolian_CallCppFunc
 * Method:    paySuccess
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_org_gzy_xiaolian_CallCppFunc_paySuccess
  (JNIEnv *, jclass, jint nCount)
{
	if(PayManager::sharedPayManager()->isPaying())
	{
		AccountManager::sharedAccountManager()->setScore(AccountManager::sharedAccountManager()->getScore() + nCount);
		PayManager::sharedPayManager()->payed();
	}
}
/*
 * Class:     org_gzy_xiaolian_CallCppFunc
 * Method:    payFailed
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_org_gzy_xiaolian_CallCppFunc_payFailed
  (JNIEnv *, jclass)
{
	PayManager::sharedPayManager()->payFailed();
}
/*
 * Class:     org_gzy_xiaolian_CallCppFunc
 * Method:    setUserUin
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_gzy_xiaolian_CallCppFunc_setUserUin
  (JNIEnv *, jclass, jstring userUin)
{
	AccountManager::sharedAccountManager()->setUserUin(JniHelper::jstring2string(userUin));
}

/*
 * Class:     org_gzy_xiaolian_CallCppFunc
 * Method:    setUserName
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_gzy_xiaolian_CallCppFunc_setUserName
  (JNIEnv *, jclass, jstring userName)
{
	AccountManager::sharedAccountManager()->setUserName(JniHelper::jstring2string(userName));
}

/*
 * Class:     org_gzy_xiaolian_CallCppFunc
 * Method:    addOrderform
 * Signature: (Ljava/lang/String;)Z
 */
JNIEXPORT jboolean JNICALL Java_org_gzy_xiaolian_CallCppFunc_addOrderform
  (JNIEnv *, jclass, jstring formStr, jint nCount)
{
	return AccountManager::sharedAccountManager()->addOrderform(JniHelper::jstring2string(formStr), nCount);
}

/*
 * Class:     org_gzy_xiaolian_CallCppFunc
 * Method:    delOrderform
 * Signature: (Ljava/lang/String;)Z
 */
JNIEXPORT jboolean JNICALL Java_org_gzy_xiaolian_CallCppFunc_delOrderform
  (JNIEnv *, jclass, jstring formStr)
{
	return AccountManager::sharedAccountManager()->delOrderform(JniHelper::jstring2string(formStr));
}

#ifdef __cplusplus
}
#endif
